import java.io.FileInputStream;
import java.io.FileNotFoundException;

class Person implements Cloneable{
    private String name;
    private String gender;
    int age;
    // 想要让该类⽀持深拷⻉，覆写Object类的clone⽅法即可
    @Override
    public Person clone() throws CloneNotSupportedException{
        return (Person)super.clone();
    }
}

public class Test2 {

    public static void func5(int a) throws CloneNotSupportedException{
        if(a == 0){
            throw new CloneNotSupportedException();
        }
        System.out.println("hei hei");
    }

    public static void func4(int a){
        try {
            if(a == 0){
                throw new CloneNotSupportedException();
            }
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
            System.out.println("捕捉到了CloneNotSupportedException");
        }
        System.out.println("heihei");
    }

    public static void func3(int a) throws CloneNotSupportedException{
        if(a == 0){
            throw new CloneNotSupportedException();
        }
    }

    public static void func2(int a){
        if(a == 0){
            throw new ArithmeticException();
        }
        System.out.println(10/a);
    }

    public static void func1(int[] array){
        if(array == null){
            throw new NullPointerException();
        }
        System.out.println(array.length);
    }

    public static void main1(String[] args) throws CloneNotSupportedException{
        /*int[] array = null;
        func1(array);*/

        //func2(0);

        /*int[] array = {1,2,3};
        System.out.println(array[100]);*/

        // func3(0);

        // func4(0);

        /*try{
            func2(0);
        }catch (ArithmeticException e){
            e.printStackTrace();
            System.out.println("捕获到了算术异常, 逻辑...");
        }
        System.out.println("haha!");*/

        try {
            func5(0);
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
            System.out.println("捕获到了CloneNotSupportedException异常");
        }

    }

    public static void main(String[] args) throws CloneNotSupportedException, FileNotFoundException {
        Person person = new Person();
        Person person1 = (Person) person.clone();

        /*FileInputStream fileInputStream = new FileInputStream("hello");*/

    }
}
